﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbCircle : OdDbCurve
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbCircle(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbCircle_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbCircle obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbCircle()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbCircle(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbCircle cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbCircle_cast(OdRxObject.getCPtr(pObj));
			OdDbCircle result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbCircle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbCircle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbCircle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbCircle_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbCircle_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbCircle_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbCircle createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbCircle_createObject();
			OdDbCircle result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbCircle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbCircle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbCircle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d center()
		{
			OdGePoint3d result = new OdGePoint3d(TD_DbPINVOKE.OdDbCircle_center(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setCenter(OdGePoint3d center)
		{
			TD_DbPINVOKE.OdDbCircle_setCenter(this.swigCPtr, OdGePoint3d.getCPtr(center));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double radius()
		{
			double result = TD_DbPINVOKE.OdDbCircle_radius(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setRadius(double radius)
		{
			TD_DbPINVOKE.OdDbCircle_setRadius(this.swigCPtr, radius);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double thickness()
		{
			double result = TD_DbPINVOKE.OdDbCircle_thickness(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setThickness(double vThickness)
		{
			TD_DbPINVOKE.OdDbCircle_setThickness(this.swigCPtr, vThickness);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeVector3d normal()
		{
			OdGeVector3d result = new OdGeVector3d(TD_DbPINVOKE.OdDbCircle_normal(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setNormal(OdGeVector3d geVector)
		{
			TD_DbPINVOKE.OdDbCircle_setNormal(this.swigCPtr, OdGeVector3d.getCPtr(geVector));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dwgInFields(OdDbDwgFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_dwgInFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dwgOutFields(OdDbDwgFiler pFiler)
		{
			TD_DbPINVOKE.OdDbCircle_dwgOutFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbCircle_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields_R12(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_dxfInFields_R12(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields_R12(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbCircle_dxfOutFields_R12(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual bool subWorldDraw(OdGiWorldDraw pWd)
		{
			bool result = TD_DbPINVOKE.OdDbCircle_subWorldDraw(this.swigCPtr, OdGiWorldDraw.getCPtr(pWd));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult subTransformBy(OdGeMatrix3d xfm)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_subTransformBy(this.swigCPtr, OdGeMatrix3d.getCPtr(xfm));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult subGetTransformedCopy(OdGeMatrix3d xfm, out OdDbEntity pCopy)
		{
			IntPtr zero = IntPtr.Zero;
			OdResult result;
			try
			{
				OdResult odResult = (OdResult)TD_DbPINVOKE.OdDbCircle_subGetTransformedCopy(this.swigCPtr, OdGeMatrix3d.getCPtr(xfm), out zero);
				if (TD_DbPINVOKE.SWIGPendingException.Pending)
				{
					throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
				}
				result = odResult;
			}
			finally
			{
				pCopy = (OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(zero, true);
			}
			return result;
		}

		public new virtual OdResult subGetClassID(IntPtr pClsid)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_subGetClassID(this.swigCPtr, pClsid);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual bool isClosed()
		{
			bool result = TD_DbPINVOKE.OdDbCircle_isClosed(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual bool isPeriodic()
		{
			bool result = TD_DbPINVOKE.OdDbCircle_isPeriodic(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual bool isPlanar()
		{
			bool result = TD_DbPINVOKE.OdDbCircle_isPlanar(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getPlane(OdGePlane gePlane, out Planarity gePlanarity)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getPlane(this.swigCPtr, OdGePlane.getCPtr(gePlane), out gePlanarity);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getStartParam(out double startParam)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getStartParam(this.swigCPtr, out startParam);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getEndParam(out double endParam)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getEndParam(this.swigCPtr, out endParam);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getStartPoint(OdGePoint3d startPoint)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getStartPoint(this.swigCPtr, OdGePoint3d.getCPtr(startPoint));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getEndPoint(OdGePoint3d endPoint)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getEndPoint(this.swigCPtr, OdGePoint3d.getCPtr(endPoint));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getPointAtParam(double param, OdGePoint3d pointOnCurve)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getPointAtParam(this.swigCPtr, param, OdGePoint3d.getCPtr(pointOnCurve));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getParamAtPoint(OdGePoint3d pointOnCurve, out double param)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getParamAtPoint(this.swigCPtr, OdGePoint3d.getCPtr(pointOnCurve), out param);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getDistAtParam(double param, out double dist)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getDistAtParam(this.swigCPtr, param, out dist);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getParamAtDist(double dist, out double param)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getParamAtDist(this.swigCPtr, dist, out param);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getFirstDeriv(double param, OdGeVector3d firstDeriv)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getFirstDeriv(this.swigCPtr, param, OdGeVector3d.getCPtr(firstDeriv));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getSecondDeriv(double param, OdGeVector3d secondDeriv)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getSecondDeriv(this.swigCPtr, param, OdGeVector3d.getCPtr(secondDeriv));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getArea(out double vArea)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getArea(this.swigCPtr, out vArea);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdGeMatrix3d getEcs()
		{
			OdGeMatrix3d result = new OdGeMatrix3d(TD_DbPINVOKE.OdDbCircle_getEcs(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getOdGeCurve(OdGeCurve3d pGeCurve, OdGeTol tol)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getOdGeCurve__SWIG_0(this.swigCPtr, pGeCurve, OdGeTol.getCPtr(tol));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult getOdGeCurve(OdGeCurve3d pGeCurve)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_getOdGeCurve__SWIG_1(this.swigCPtr, pGeCurve);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult setFromOdGeCurve(OdGeCurve3d geCurve, OdGeVector3d normal, OdGeTol tol)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_setFromOdGeCurve__SWIG_0(this.swigCPtr, OdGeCurve3d.getCPtr(geCurve), OdGeVector3d.getCPtr(normal), OdGeTol.getCPtr(tol));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult setFromOdGeCurve(OdGeCurve3d geCurve, OdGeVector3d normal)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_setFromOdGeCurve__SWIG_1(this.swigCPtr, OdGeCurve3d.getCPtr(geCurve), OdGeVector3d.getCPtr(normal));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult setFromOdGeCurve(OdGeCurve3d geCurve)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbCircle_setFromOdGeCurve__SWIG_2(this.swigCPtr, OdGeCurve3d.getCPtr(geCurve));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
